﻿using System;
using System.Configuration;

namespace FutureApp.Configuration
{
    /// <summary>
    /// 配置管理器
    /// </summary>
    public static class SettingsManager
    {
        /// <summary>
        /// 获取布尔配置值
        /// </summary>
        /// <param name="settingName">配置节点名</param>
        /// <returns>返回布尔配置值</returns>
        public static bool GetAppBooleanSetting(string settingName)
        {
            return string.Equals(
                GetAppSetting(settingName),
                "true",
                StringComparison.InvariantCultureIgnoreCase
            );
        }

        /// <summary>
        /// 获取配置值
        /// </summary>
        /// <param name="settingName">配置节点名</param>
        /// <returns>返回配置值</returns>
        public static string GetAppSetting(string settingName)
        {
            return ConfigurationManager.AppSettings[settingName];
        }
    }
}
